package com.xavier.utils;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class PassWordUtils {

    private final static String PWD_ENCRYPT_KEY = "xavierpwd2240331";

    /**
     * 用户密码解密
     */
    public static String decryptUserPwd(String userPwd) {
        if (StrUtil.isEmpty(userPwd)) {
            throw new ServiceException("密码错误");
        }
        try {
            return AESUtil.decrypt(userPwd, PWD_ENCRYPT_KEY);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new ServiceException("密码错误");
        }
    }

}
